﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using PlanningGIS.Util.Data;
using PlanningGIS.ManageUtility.Modules;

namespace PlanningGIS.ManageUtility.DataAccess
{
    /// <summary>
    /// 部门数据操作
    /// </summary>
    public class DepartmentAccess
    {
        /// <summary>
        /// 删除部门
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static bool DeleteDepartment(string id)
        {
            List<string> sqls = new List<string>();
            sqls.Add("delete from DEPARTMENT where id=:id ");
            sqls.Add("update USERINFO set department_id ='' where department_id=:id ");
            List<Dictionary<string, dynamic>> values = new List<Dictionary<string, dynamic>>();
            Dictionary<string, dynamic> p = new Dictionary<string, dynamic>();
            p.Add(":id", id);
            values.Add(p);
            values.Add(p);
            int num = ManageHelper.DBContext.ExecuteNonQuery(sqls, values);
            return num > 0;
        }
    }
}
